package com.CGFrame.struts.bean.unit;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import org.apache.commons.configuration.Configuration;

import com.CGFrame.struts.POJOs.Projectconfig;
import com.CGFrame.struts.POJOs.Shot;
import com.CGFrame.struts.POJOs.Shotgroup;
import com.CGFrame.struts.bean.ProjectOperate;
import com.CGFrame.struts.bean.ProjectOperateFactory;
import com.CGFrame.tools.FileFilter;
import com.config.GenericConfig;

public class ShotBean {
	private Shot shot;
	
	/** 获取根目录 */
	 private String filebase = GenericConfig.getInstance().getFileBase();

	public ShotBean() {

	}

	public ShotBean(int id) {
		ProjectOperate pop = ProjectOperateFactory.getprojectOperate();
		shot = (Shot) pop.UniqueQuery("Shot", "shotId," + id);
	}
	public String getStoryBoardPath()
	{
		return   FilePathGenerator.getStoryBoard(this.shot.getShotId(), "Shot").toString();	
	}
	
	
	public ArrayList getStoryBoardFiles()
	{
		
		String path = this.getStoryBoardPath();
		String abpath = filebase+path;
		return FileFilter.getFiles(abpath, this.getShotName());
	}
	
	
	
	
	
	public LinkedList getShotGroupName() {
		LinkedList<String> list = new LinkedList<String>();
		Shotgroup shotgroup = shot.getShotgroup();
		while (shotgroup != null) {
			list.addFirst(shotgroup.getShotGroupName());
			shotgroup = shotgroup.getShotgroup();
		}
		return list;
	}

	public String getShotName() {
		return shot.getShotName();
	}

	public String getProjectName() {
		return shot.getShotgroup().getProject().getProjectName();
	}

	public Shot getShot() {
		return shot;
	}

	public void setShot(Shot shot) {
		this.shot = shot;
	}

}
